
#include "../libpatches.h"
#include "sh.h"
#include <stdio.h>
#include <stdlib.h>
#include <float.h>

static void module_sh_processor(module m);
void module_sh_customizer(module m, char * name, char * value);

void module_sh_initializer(module m) {
	m->customizer = module_sh_customizer;
}

void module_sh_customizer(module m, char * name, char * value) {

	customizer_count_inputs_only(m, name, value);
	if (m->input_count && ! m->inputs) {
		make_named_inputs(m, m->input_count, 1);
		make_outputs(m, m->input_count);
		m->input_names[0] = "trigger";

		m->processor = module_sh_processor;
	} 
}

static void module_sh_processor(module m) {
	input t = m->named_inputs[0];
	input * i;
	output * o;
	int c;

	if (**t)
		for (
			i = m->inputs, 
			o = m->outputs, 
			c = m->input_count;
			c;
			--c, ++i, ++o
		)
			**o = ***i;
}
